<template>
  <header class="header">
    <div class="search-box">
      <input
          v-model="searchQuery"
          type="text"
          placeholder="搜索文章..."
          class="search-input"
      />
      <button @click="searchArticles" class="search-button">
        <span class="search-icon">🔍</span>
      </button>
    </div>
  </header>
</template>

<script setup>
import { ref } from 'vue';

const searchQuery = ref('');

const searchArticles = () => {
  console.log('搜索关键词:', searchQuery.value);
};
</script>

<style scoped>
.header {
  text-align: center;
  margin: 40px 0;
}

.search-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

.search-input {
  padding: 12px 20px;
  width: 300px;
  border: 2px solid #1a73e8;
  border-radius: 25px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background-color: white;
  color: #333;
}

.search-input:focus {
  border-color: #1557b0;
  box-shadow: 0 0 8px rgba(26, 115, 232, 0.3);
}

.search-button {
  padding: 12px 20px;
  margin-left: 10px;
  background-color: #1a73e8;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.search-button:hover {
  background-color: #1557b0;
  transform: scale(1.05);
}

.search-icon {
  font-size: 1.2rem;
}
</style>